<?php

if($isApprove){

  /**
   * is to insert the DP balance with minus
   * fetch the amount per sub
   */
  $CLFetchers->fetchSubDp($COracle,
                          $jobId,
                          $SourceDb->fetchValue("srcDbSubDp"),
                          $nSubDtl,
                          $lstSubDtl);

  for($iRow = 0; $iRow < $nSubDtl ; $iRow++){

    $amount = $lstSubDtl["AMOUNT"][$iRow] * -1;

    $values = "  ".$periode.",  ".
              " '".$lstHeader["SUPPLIER_CODE"][0]."', ".
              " '".$lstHeader["NOTA_SRC"][0]."',      ".
              " '".$lstSubDtl["REFERENCE"][$iRow]."', ".
              "  ".$txDate.",   ".
              "  ".$txDate.",   ".
              "  ".$dueDate.",  ".
              "  ".$txType.",   ".
              "  ".$amount." ,  ".
              "  1              "; /* This is the default number */

    $CLHandlers->insToMutInvoice($COracle,
                                 "SUPPLIER_CODE",
                                 $values,
                                 $SourceDb->fetchValue("srcDbMutDp"));
  }

}else{

  /**
   * process the cancelation
   */
  $CHandlers->dbEntDelete2($COracle,
                           $refId,
                           $SourceDb->fetchValue("srcDbMutIvcSupplier"));
}

?>